// 工具栏的按钮
<template>
  <el-row>
    <el-col :span="18">
      <el-divider direction="vertical"></el-divider>
      <el-button type="text"
                 size="mini"
                 @click="showSearchDialog()">内容查询</el-button>
      <el-divider direction="vertical"></el-divider>
      <el-button type="text"
                 size="mini"
                 @click="selectAll()">全选</el-button>
      <el-divider direction="vertical"></el-divider>
      <el-button type="text"
                 size="mini"
                 @click="selectNotAll()">全不选</el-button>
      <el-button type="text"
                 size="mini"
                 @click="add_handler()">新增</el-button>
      <el-divider direction="vertical"></el-divider>
      <el-button type="text"
                 size="mini"
                 @click="delete_handler()">删除</el-button>
      <el-divider direction="vertical"></el-divider>
      <el-button type="text"
                 size="mini"
                 @click="edit_handler()">编辑</el-button>
      <el-divider direction="vertical"></el-divider>
      <el-button type="text"
                 size="mini">导入</el-button>
      <el-divider direction="vertical"></el-divider>
      <el-button type="text"
                 size="mini">导出</el-button>
      <el-divider direction="vertical"></el-divider>
      <el-button type="text"
                 size="mini"
                 @click="refresh()">刷新</el-button>
      <el-divider direction="vertical"></el-divider>
    </el-col>
  </el-row>
</template>
<script>
export default {
  data: function () {
    return {

    }
  },
  methods: {
    // 点击内容查询弹出查询条件框
    showSearchDialog () {
      this.$emit('controlSearchDialog', true)
    },
    // 全选
    selectAll () {
      this.$emit('selectAll', true)
    },
    // 全不选
    selectNotAll () {
      this.$emit('selectNotAll', true)
    },
    // 删除
    delete_handler () {
      this.$emit('delete')
    },
    // 刷新
    refresh () {
      this.$parent.refreshTable()
    },
    // 编辑
    edit_handler () {
      if (this.$parent.$refs['table'].selection.length !== 1) {
        this.$message.warning('请选择一条数据进行编辑！')
        return
      }
      this.$emit('edit_handler', true)
    },
    // 新增
    add_handler () {
      this.$emit('add_handler', true)
    }
  }
}
</script>

<style scoped>
</style>
